var http = require('http');
var url = require('url');
var fs = require('fs');
var qs = require('querystring');

var haha = http.createServer(function(req,res){
	var urll = url.parse(req.url).pathname;
	var method = req.method;
	res.setHeader('Access-Control-Allow-Origin', '*');
	res.writeHead(200,{'Content-Type':'text/html;charset=utf-8'})
	if(method=='GET'){
		switch (urll){
			case "/diyi":test('./hehe.json',res);
				break;
			default:
				break;
		}
	}else{}
})

haha.listen(9999);
function test(url,res){
	fs.readFile(url,'utf-8',function(err,data){
		if(!err){
			res.end(data);
		}
	})
}

